home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Text / WASTE / WASTE 1.1.2 Distribution / WASTE Interfaces / WASTE.p < prev   
Encoding:
Text File  |  1995-10-12  |  20.0 KB  |  640 lines  |  [TEXT/CWIE]

  1. unit WASTE;
  2.  
  3. { Pascal interface to the WASTE text engine }
  4.  
  5. { version 1.1.2 (September 1995) }
  6.  
  7. { Copyright © 1993-1995 Marco Piovanelli }
  8. { All Rights Reserved }
  9.  
  10. interface
  11.     uses
  12.         ConditionalMacros, Types, Events, Quickdraw, QuickdrawText, TextUtils, Drag, LongCoords;
  13.  
  14.     const
  15.  
  16. { result codes }
  17.  
  18.         weCantUndoErr = -10015;                        { undo buffer is clear (= errAECantUndo) }
  19.         weEmptySelectionErr = -10013;                { empty selection range (= errAENoUserSelection) }
  20.         weUnknownObjectTypeErr = -9478;            { specified object type is not registered }
  21.         weObjectNotFoundErr = -9477;                    { no object found at specified offset }
  22.         weReadOnlyErr = -9476;                            { cannot modify instance }
  23.         weUndefinedSelectorErr = -50;                    { unknown selector (= paramErr) }
  24.  
  25. { alignment styles }
  26.  
  27.         weFlushLeft = -2;                        { flush left }
  28.         weFlushRight = -1;                    { flush right }
  29.         weFlushDefault = 0;                    { flush according to system direction }
  30.         weCenter = 1;                            { centered }
  31.         weJustify = 2;                            { fully justified }
  32.  
  33. { values for the mode parameter in WESetStyle and WEContinuousStyle }
  34.  
  35.         weDoFont = $0001;                    { set font family number }
  36.         weDoFace = $0002;                    { turn on the styles specified in tsFace }
  37.         weDoSize = $0004;                    { set type size }
  38.         weDoColor = $0008;                    { set color }
  39.         weDoAll = weDoFont + weDoFace + weDoSize + weDoColor;
  40.         weDoAddSize = $0010;                { adjust type size }
  41.         weDoToggleFace = $0020;            { turn a style off if it's continuous over the selection }
  42.         weDoReplaceFace = $0040;        { replace existing styles outright }
  43.  
  44. { values for the edge parameter in WEGetOffset etc. }
  45.  
  46.         kLeadingEdge = -1;                    { point is on the leading edge of a glyph }
  47.         kTrailingEdge = 0;                        { point is on the trailing edge of a glyph }
  48.         kObjectEdge = 2;                        { point is in the middle of an embedded object }
  49.  
  50. { values for WEFeatureFlag feature parameter }
  51.  
  52.         weFAutoScroll = 0;                    { automatically scroll the selection range into view }
  53.         weFOutlineHilite = 2;                { frame selection when deactivated }
  54.         weFReadOnly = 5;                        { disallow modifications }
  55.         weFUndo = 6;                            { support WEUndo }
  56.         weFIntCutAndPaste = 7;            { use intelligent cut-and-paste rules }
  57.         weFDragAndDrop = 8;                { support drag-and-drop text editing }
  58.         weFInhibitRecal = 9;                    { don't recalculate line starts and don't redraw text }
  59.         weFUseTempMem = 10;            { use temporary memory for main data structures }
  60.         weFDrawOffscreen = 11;            { draw text offscreen for smoother visual results }
  61.  
  62. { values for WENew flags parameter }
  63.  
  64.         weDoAutoScroll = $0001;
  65.         weDoOutlineHilite = $0004;
  66.         weDoReadOnly = $0020;
  67.         weDoUndo = $0040;
  68.         weDoIntCutAndPaste = $0080;
  69.         weDoDragAndDrop = $0100;
  70.         weDoInhibitRecal = $0200;
  71.         weDoUseTempMem = $0400;
  72.         weDoDrawOffscreen = $0800;
  73.  
  74. { values for WEFeatureFlag action parameter }
  75.  
  76.         weBitToggle = -2;                        { toggles the specified feature }
  77.         weBitTest = -1;                            { returns the current setting of the specified feature }
  78.         weBitClear = 0;                            { disables the specified feature }
  79.         weBitSet = 1;                            { enables the specified feature }
  80.  
  81. { values for WEGetInfo and WESetInfo selector parameter }
  82.  
  83.         weCharToPixelHook = 'c2p ';        { CharToPixel hook }
  84.         weClickLoop = 'clik';                    { click loop callback }
  85.         weCurrentDrag = 'drag';            { drag currently being tracked from WEClick }
  86.         weDrawTextHook = 'draw';        { text drawing hook }
  87.         weLineBreakHook = 'lbrk';        { line breaking hook }
  88.         wePixelToCharHook = 'p2c ';        { PixelToChar hook }
  89.         wePort = 'port';                            { graphics port }
  90.         weRefCon = 'refc';                        { reference constant for use by application }
  91.         weScrollProc = 'scrl';                    { scroll callback }
  92.         weText = 'text';                            { handle to the raw text }
  93.         weTranslateDragHook = 'xdrg';    { drag translation callback }
  94.         weTSMDocumentID = 'tsmd';        { Text Services Manager document ID }
  95.         weTSMPreUpdate = 'pre ';            { Text Services Manager pre-update callback }
  96.         weTSMPostUpdate = 'post';        { Text Services Manager post-update callback }
  97.  
  98. { values for WEInstallObjectHandler handlerSelector parameter }
  99.  
  100.         weNewHandler = 'new ';            { new handler }
  101.         weDisposeHandler = 'free';        { dispose handler }
  102.         weDrawHandler = 'draw';            { draw handler }
  103.         weClickHandler = 'clik';                { click handler }
  104.  
  105. { action kinds }
  106.  
  107.         weAKNone = 0;                            { null action }
  108.         weAKUnspecified = 1;                { action of unspecified nature }
  109.         weAKTyping = 2;                        { some text has been typed in }
  110.         weAKCut = 3;                            { the selection range has been cut }
  111.         weAKPaste = 4;                            { something has been pasted }
  112.         weAKClear = 5;                            { the selection range has been deleted }
  113.         weAKDrag = 6;                            { drag and drop operation }
  114.         weAKSetStyle = 7;                    { some style has been applied to a text range }
  115.  
  116.     type
  117.  
  118. { WASTE data types }
  119.  
  120.         WEReference = Ptr;
  121.         WEHandle = WEReference;        { obsolete; kept for backward compatibility }
  122.         WEObjectReference = Ptr;
  123.         WESoupHandle = Handle;
  124.         WEActionKind = Integer;
  125.  
  126.         WERunInfo = record
  127.                 runStart: LongInt;                            { byte offset to first character of style run }
  128.                 runEnd: LongInt;                            { byte offset past last character of style run }
  129.                 runHeight: Integer;                        { line height (ascent + descent + leading) }
  130.                 runAscent: Integer;                        { font ascent }
  131.                 runStyle: TextStyle;                        { text attributes }
  132.                 runObject: WEObjectReference;        { either NIL or reference to embedded object }
  133.             end;  { WERunInfo }
  134.  
  135. { callback prototypes }
  136.  
  137. { FUNCTION MyClickLoop(we: WEReference): Boolean; }
  138.         WEClickLoopProcPtr = ProcPtr;
  139.         WEClickLoopUPP = UniversalProcPtr;
  140.  
  141. { PROCEDURE MyScrollProc(we: WEReference); }
  142.         WEScrollProcPtr = ProcPtr;
  143.         WEScrollUPP = UniversalProcPtr;
  144.  
  145. { PROCEDURE MyTSMPreUpdate(we: WEReference); }
  146.         WETSMPreUpdateProcPtr = ProcPtr;
  147.         WETSMPreUpdateUPP = UniversalProcPtr;
  148.  
  149. { PROCEDURE MyTSMPostUpdate(we: WEReference; fixLength: LongInt; }
  150. {         inputAreaStart, inputAreaEnd:LongInt; }
  151. {        pinRangeStart, pinRangeEnd: LongInt); }
  152.         WETSMPostUpdateProcPtr = ProcPtr;
  153.         WETSMPostUpdateUPP = UniversalProcPtr;
  154.  
  155. { FUNCTION MyTranslateDrag (theDrag: DragReference; theItem: ItemReference; }
  156. {         requestedType: FlavorType; putDataHere: Handle): OSErr; }
  157.         WETranslateDragProcPtr = ProcPtr;
  158.         WETranslateDragUPP = UniversalProcPtr;
  159.  
  160. { PROCEDURE MyDrawText (pText: Ptr; textLength: LongInt; slop: Fixed; }
  161. {         styleRunPosition: JustStyleCode; we: WEReference); }
  162.         WEDrawTextProcPtr = ProcPtr;
  163.         WEDrawTextUPP = UniversalProcPtr;
  164.  
  165. { FUNCTION MyPixelToChar (pText: Ptr; textLength: LongInt; slop: Fixed; }
  166. {         VAR pixelWidth: Fixed; VAR edge: SignedByte; }
  167. {         styleRunPosition: JustStyleCode; hPos: Fixed; we: WEReference): LongInt; }
  168.         WEPixelToCharProcPtr = ProcPtr;
  169.         WEPixelToCharUPP = UniversalProcPtr;
  170.  
  171. { FUNCTION MyCharToPixel (pText: Ptr; textLength: LongInt; slop: Fixed; }
  172. {        offset: LongInt; direction: Integer; }
  173. {        styleRunPosition: JustStyleCode; hPos: LongInt; we:WEReference): Integer; }
  174.         WECharToPixelProcPtr = ProcPtr;
  175.         WECharToPixelUPP = UniversalProcPtr;
  176.  
  177. { FUNCTION MyLineBreak (pText: Ptr; textLength: LongInt; }
  178. {        textStart, textEnd: LongInt; VAR textWidth: Fixed; VAR textOffset: LongInt; }
  179. {        we: WEReference): StyledLineBreakCode; }
  180.         WELineBreakProcPtr = ProcPtr;
  181.         WELineBreakUPP = UniversalProcPtr;
  182.  
  183. { FUNCTION MyNewObject(VAR defaultObjectSize: Point; }
  184. {                    objectRef: WEObjectReference): OSErr; }
  185.         WENewObjectProcPtr = ProcPtr;
  186.         WENewObjectUPP = UniversalProcPtr;
  187.  
  188. { FUNCTION MyDisposeObject (objectRef: WEObjectReference): OSErr; }
  189.         WEDisposeObjectProcPtr = ProcPtr;
  190.         WEDisposeObjectUPP = UniversalProcPtr;
  191.  
  192. { FUNCTION MyDrawObject (var destRect: Rect; }
  193. {         objectRef: WEObjectReference): OSErr }
  194.         WEDrawObjectProcPtr = ProcPtr;
  195.         WEDrawObjectUPP = UniversalProcPtr;
  196.  
  197. { FUNCTION MyClickObject (hitPt: Point; modifiers: EventModifiers; clickTime: LongInt; }
  198. {         objectRef: WEObjectReference): Boolean; }
  199.         WEClickObjectProcPtr = ProcPtr;
  200.         WEClickObjectUPP = UniversalProcPtr;
  201.  
  202.     const
  203.  
  204. { UPP proc info }
  205.  
  206.         uppWEClickLoopProcInfo = $000000D0;
  207.         uppWEScrollProcInfo = $000000C0;
  208.         uppWETSMPreUpdateProcInfo = $000000C0;
  209.         uppWETSMPostUpdateProcInfo = $0003FFC0;
  210.         uppWETranslateDragProcInfo = $00003FE0;
  211.         uppWEDrawTextProcInfo = $0000EFC0;
  212.         uppWEPixelToCharProcInfo = $003EFFF0;
  213.         uppWECharToPixelProcInfo = $003EBFE0;
  214.         uppWELineBreakProcInfo = $000FFFD0;
  215.         uppWENewObjectProcInfo = $000003E0;
  216.         uppWEDisposeObjectProcInfo = $000000E0;
  217.         uppWEDrawObjectProcInfo = $000003E0;
  218.         uppWEClickObjectProcInfo = $00003ED0;
  219.  
  220. { NewProc macros }
  221.  
  222.     function NewWEClickLoopProc (userRoutine: WEClickLoopProcPtr): WEClickLoopUPP;
  223. {$IFC NOT GENERATINGCFM}
  224.     inline
  225.         $2E9F;
  226. {$ENDC}
  227.  
  228.     function NewWEScrollProc (userRoutine: WEScrollProcPtr): WEScrollUPP;
  229. {$IFC NOT GENERATINGCFM}
  230.     inline
  231.         $2E9F;
  232. {$ENDC}
  233.  
  234.     function NewWETSMPreUpdateProc (userRoutine: WETSMPreUpdateProcPtr): WETSMPreUpdateUPP;
  235. {$IFC NOT GENERATINGCFM}
  236.     inline
  237.         $2E9F;
  238. {$ENDC}
  239.  
  240.     function NewWETSMPostUpdateProc (userRoutine: WETSMPostUpdateProcPtr): WETSMPostUpdateUPP;
  241. {$IFC NOT GENERATINGCFM}
  242.     inline
  243.         $2E9F;
  244. {$ENDC}
  245.  
  246.     function NewWETranslateDragProc (userRoutine: WETranslateDragProcPtr): WETranslateDragUPP;
  247. {$IFC NOT GENERATINGCFM}
  248.     inline
  249.         $2E9F;
  250. {$ENDC}
  251.  
  252.     function NewWEDrawTextProc (userRoutine: WEDrawTextProcPtr): WEDrawTextUPP;
  253. {$IFC NOT GENERATINGCFM}
  254.     inline
  255.         $2E9F;
  256. {$ENDC}
  257.  
  258.     function NewWEPixelToCharProc (userRoutine: WEPixelToCharProcPtr): WEPixelToCharUPP;
  259. {$IFC NOT GENERATINGCFM}
  260.     inline
  261.         $2E9F;
  262. {$ENDC}
  263.  
  264.     function NewWECharToPixelProc (userRoutine: WECharToPixelProcPtr): WECharToPixelUPP;
  265. {$IFC NOT GENERATINGCFM}
  266.     inline
  267.         $2E9F;
  268. {$ENDC}
  269.  
  270.     function NewWELineBreakProc (userRoutine: WELineBreakProcPtr): WELineBreakUPP;
  271. {$IFC NOT GENERATINGCFM}
  272.     inline
  273.         $2E9F;
  274. {$ENDC}
  275.  
  276.     function NewWENewObjectProc (userRoutine: WENewObjectProcPtr): WENewObjectUPP;
  277. {$IFC NOT GENERATINGCFM}
  278.     inline
  279.         $2E9F;
  280. {$ENDC}
  281.  
  282.     function NewWEDisposeObjectProc (userRoutine: WEDisposeObjectProcPtr): WEDisposeObjectUPP;
  283. {$IFC NOT GENERATINGCFM}
  284.     inline
  285.         $2E9F;
  286. {$ENDC}
  287.  
  288.     function NewWEDrawObjectProc (userRoutine: WEDrawObjectProcPtr): WEDrawObjectUPP;
  289. {$IFC NOT GENERATINGCFM}
  290.     inline
  291.         $2E9F;
  292. {$ENDC}
  293.  
  294.     function NewWEClickObjectProc (userRoutine: WEClickObjectProcPtr): WEClickObjectUPP;
  295. {$IFC NOT GENERATINGCFM}
  296.     inline
  297.         $2E9F;
  298. {$ENDC}
  299.  
  300. { CallProc macros }
  301.  
  302.     function CallWEClickLoopProc (we: WEReference;
  303.                                     userRoutine: WEClickLoopUPP): Boolean;
  304. {$IFC NOT GENERATINGCFM}
  305.     inline
  306.         $205F, $4E90;
  307. {$ENDC}
  308.  
  309.     procedure CallWEScrollProc (we: WEReference;
  310.                                     userRoutine: WEScrollUPP);
  311. {$IFC NOT GENERATINGCFM}
  312.     inline
  313.         $205F, $4E90;
  314. {$ENDC}
  315.  
  316.     procedure CallWETSMPreUpdateProc (we: WEReference;
  317.                                     userRoutine: WETSMPreUpdateUPP);
  318. {$IFC NOT GENERATINGCFM}
  319.     inline
  320.         $205F, $4E90;
  321. {$ENDC}
  322.  
  323.     procedure CallWETSMPostUpdateProc (we: WEReference;
  324.                                     fixLength: LongInt;
  325.                                     inputAreaStart, inputAreaEnd: LongInt;
  326.                                     pinRangeStart, pinRangeEnd: LongInt;
  327.                                     userRoutine: WETSMPostUpdateUPP);
  328. {$IFC NOT GENERATINGCFM}
  329.     inline
  330.         $205F, $4E90;
  331. {$ENDC}
  332.  
  333.     function CallTranslateDrag (theDrag: DragReference;
  334.                                     theItem: ItemReference;
  335.                                     requestedType: FlavorType;
  336.                                     putDataHere: Handle;
  337.                                     userRoutine: WETranslateDragUPP): OSErr;
  338. {$IFC NOT GENERATINGCFM}
  339.     inline
  340.         $205F, $4E90;
  341. {$ENDC}
  342.  
  343.     procedure CallWEDrawTextProc (pText: Ptr;
  344.                                     textLength: LongInt;
  345.                                     slop: Fixed;
  346.                                     styleRunPosition: JustStyleCode;
  347.                                     we: WEReference;
  348.                                     userRoutine: WEDrawTextUPP);
  349. {$IFC NOT GENERATINGCFM}
  350.     inline
  351.         $205F, $4E90;
  352. {$ENDC}
  353.  
  354.     function CallWEPixelToCharProc (pText: Ptr;
  355.                                     textLength: LongInt;
  356.                                     slop: Fixed;
  357.                                     var width: Fixed;
  358.                                     var edge: SignedByte;
  359.                                     styleRunPosition: JustStyleCode;
  360.                                     hPos: Fixed;
  361.                                     we: WEReference;
  362.                                     userRoutine: WEPixelToCharUPP): LongInt;
  363. {$IFC NOT GENERATINGCFM}
  364.     inline
  365.         $205F, $4E90;
  366. {$ENDC}
  367.  
  368.     function CallWECharToPixelProc (pText: Ptr;
  369.                                     textLength: LongInt;
  370.                                     slop: Fixed;
  371.                                     offset: LongInt;
  372.                                     direction: Integer;
  373.                                     styleRunPosition: JustStyleCode;
  374.                                     hPos: LongInt;
  375.                                     we: WEReference;
  376.                                     userRoutine: WECharToPixelUPP): Integer;
  377. {$IFC NOT GENERATINGCFM}
  378.     inline
  379.         $205F, $4E90;
  380. {$ENDC}
  381.  
  382.     function CallWELineBreakProc (pText: Ptr;
  383.                                     textLength: LongInt;
  384.                                     textStart, textEnd: LongInt;
  385.                                     var textWidth: Fixed;
  386.                                     var textOffset: LongInt;
  387.                                     we: WEReference;
  388.                                     userRoutine: WELineBreakUPP): StyledLineBreakCode;
  389. {$IFC NOT GENERATINGCFM}
  390.     inline
  391.         $205F, $4E90;
  392. {$ENDC}
  393.  
  394.     function CallWENewObjectProc (var defaultObjectSize: Point;
  395.                                     objectRef: WEObjectReference;
  396.                                     userRoutine: WENewObjectUPP): OSErr;
  397. {$IFC NOT GENERATINGCFM}
  398.     inline
  399.         $205F, $4E90;
  400. {$ENDC}
  401.  
  402.     function CallWEDisposeObjectProc (objectRef: WEObjectReference;
  403.                                     userRoutine: WEDisposeObjectUPP): OSErr;
  404. {$IFC NOT GENERATINGCFM}
  405.     inline
  406.         $205F, $4E90;
  407. {$ENDC}
  408.  
  409.     function CallWEDrawObjectProc ({const} var destRect: Rect;
  410.                                     objectRef: WEObjectReference;
  411.                                     userRoutine: WEDrawObjectUPP): OSErr;
  412. {$IFC NOT GENERATINGCFM}
  413.     inline
  414.         $205F, $4E90;
  415. {$ENDC}
  416.  
  417.     function CallWEClickObjectProc (hitPoint: Point;
  418.                                     modifiers: EventModifiers;
  419.                                     clickTime: LongInt;
  420.                                     objectRef: WEObjectReference;
  421.                                     userRoutine: WEClickObjectUPP): Boolean;
  422. {$IFC NOT GENERATINGCFM}
  423.     inline
  424.         $205F, $4E90;
  425. {$ENDC}
  426.  
  427.  
  428. { WASTE PUBLIC CALLS }
  429.  
  430. { creation and destruction }
  431.     function WENew ({const} var destRect, viewRect: LongRect;
  432.                                     flags: Integer;
  433.                                     var we: WEReference): OSErr;
  434.     procedure WEDispose (we: WEReference);
  435.  
  436. { getting variables }
  437.     function WEGetText (we: WEReference): Handle;
  438.     function WEGetChar (offset: LongInt;
  439.                                     we: WEReference): Char;
  440.     function WEGetTextLength (we: WEReference): LongInt;
  441.     function WECountLines (we: WEReference): LongInt;
  442.     function WEGetHeight (startLine, endLine: LongInt;
  443.                                     we: WEReference): LongInt;
  444.     procedure WEGetSelection (var selStart, selEnd: LongInt;
  445.                                     we: WEReference);
  446.     procedure WEGetDestRect (var destRect: LongRect;
  447.                                     we: WEReference);
  448.     procedure WEGetViewRect (var viewRect: LongRect;
  449.                                     we: WEReference);
  450.     function WEIsActive (we: WEReference): Boolean;
  451.     function WEOffsetToLine (offset: LongInt;
  452.                                     we: WEReference): LongInt;
  453.  
  454. { setting variables }
  455.     procedure WESetSelection (selStart, selEnd: LongInt;
  456.                                     we: WEReference);
  457.     procedure WESetDestRect ({const} var destRect: LongRect;
  458.                                     we: WEReference);
  459.     procedure WESetViewRect ({const} var viewRect: LongRect;
  460.                                     we: WEReference);
  461.  
  462. { accessing style run information }
  463.     function WEContinuousStyle (var mode: Integer;
  464.                                     var ts: TextStyle;
  465.                                     we: WEReference): Boolean;
  466.     procedure WEGetRunInfo (offset: LongInt;
  467.                                     var info: WERunInfo;
  468.                                     we: WEReference);
  469.  
  470. { converting byte offsets to screen positions and vice versa }
  471.     function WEGetOffset ({const} var thePoint: LongPt;
  472.                                     var edge: SignedByte;
  473.                                     we: WEReference): LongInt;
  474.     procedure WEGetPoint (offset: LongInt;
  475.                                     var thePoint: LongPt;
  476.                                     var lineHeight: Integer;
  477.                                     we: WEReference);
  478.  
  479. { finding words and lines }
  480.     procedure WEFindWord (offset: LongInt;
  481.                                     edge: SignedByte;
  482.                                     var wordStart, wordEnd: LongInt;
  483.                                     we: WEReference);
  484.     procedure WEFindLine (offset: LongInt;
  485.                                     edge: SignedByte;
  486.                                     var lineStart, lineEnd: LongInt;
  487.                                     we: WEReference);
  488.  
  489. { making a copy of a text range }
  490.     function WECopyRange (rangeStart, rangeEnd: LongInt;
  491.                                     hText: Handle;
  492.                                     hStyles: StScrpHandle;
  493.                                     hSoup: WESoupHandle;
  494.                                     we: WEReference): OSErr;
  495.  
  496. { getting and setting the alignment style }
  497.     function WEGetAlignment (we: WEReference): SignedByte;
  498.     procedure WESetAlignment (alignment: SignedByte;
  499.                                     we: WEReference);
  500.  
  501. { recalculating line breaks, drawing and scrolling }
  502.     function WECalText (we: WEReference): OSErr;
  503.     procedure WEUpdate (updateRgn: RgnHandle;
  504.                                     we: WEReference);
  505.     procedure WEScroll (hOffset, vOffset: LongInt;
  506.                                     we: WEReference);
  507.     procedure WESelView (we: WEReference);
  508.  
  509. { handling activate/deactivate events }
  510.     procedure WEActivate (we: WEReference);
  511.     procedure WEDeactivate (we: WEReference);
  512.  
  513. { handling key-down events }
  514.     procedure WEKey (key: Char;
  515.                                     modifiers: EventModifiers;
  516.                                     we: WEReference);
  517.  
  518. { handling mouse-down events and mouse tracking }
  519.     procedure WEClick (hitPt: Point;
  520.                                     modifiers: EventModifiers;
  521.                                     clickTime: LongInt;
  522.                                     we: WEReference);
  523.  
  524. { adjusting the cursor shape }
  525.     function WEAdjustCursor (mouseLoc: Point;
  526.                                     mouseRgn: RgnHandle;
  527.                                     we: WEReference): Boolean;
  528.  
  529. { blinking the caret }
  530.     procedure WEIdle (var maxSleep: LongInt;
  531.                                     we: WEReference);
  532.  
  533. { modifying the text and the styles }
  534.     function WEInsert (pText: Ptr;
  535.                                     textLength: LongInt;
  536.                                     hStyles: StScrpHandle;
  537.                                     hSoup: WESoupHandle;
  538.                                     we: WEReference): OSErr;
  539.     function WEDelete (we: WEReference): OSErr;
  540.     function WESetStyle (mode: Integer;
  541.                                     {const} var ts: TextStyle;
  542.                                     we: WEReference): OSErr;
  543.     function WEUseText (hText: Handle;
  544.                                     we: WEReference): OSErr;
  545.     function WEUseStyleScrap (hStyles: StScrpHandle;
  546.                                     we: WEReference): OSErr;
  547.  
  548. { undo }
  549.     function WEUndo (we: WEReference): OSErr;
  550.     procedure WEClearUndo (we: WEReference);
  551.     function WEGetUndoInfo (var redoFlag: Boolean;
  552.                                     we: WEReference): WEActionKind;
  553.     function WEIsTyping (we: WEReference): Boolean;
  554.  
  555. { keeping track of changes }
  556.     function WEGetModCount (we: WEReference): LongInt;
  557.     procedure WEResetModCount (we: WEReference);
  558.  
  559. { embedded objects }
  560.     function WEInstallObjectHandler (objectType: OSType;
  561.                                     handlerSelector: OSType;
  562.                                     handler: ProcPtr;
  563.                                     we: WEReference): OSErr;
  564.     function WEInsertObject (objectType: OSType;
  565.                                     objectDataHandle: Handle;
  566.                                     objectSize: Point;        { (0, 0) means default size }
  567.                                     we: WEReference): OSErr;
  568.     function WEGetSelectedObject (var objectRef: WEObjectReference;
  569.                                     we: WEReference): OSErr;
  570.     function WEFindNextObject (offset: LongInt;
  571.                                     var objectRef: WEObjectReference;
  572.                                     we: WEReference): LongInt;
  573.  
  574. { accessing embedded object attributes }
  575.     function WEGetObjectType (objectRef: WEObjectReference): OSType;
  576.     function WEGetObjectDataHandle (objectRef: WEObjectReference): Handle;
  577.     function WEGetObjectSize (objectRef: WEObjectReference): Point;
  578.     function WEGetObjectOwner (objectRef: WEObjectReference): WEReference;
  579.     function WEGetObjectRefCon (objectRef: WEObjectReference): LongInt;
  580.     procedure WESetObjectRefCon (objectRef: WEObjectReference;
  581.                                     refCon: LongInt);
  582.  
  583. { Clipboard operations }
  584.     function WECut (we: WEReference): OSErr;
  585.     function WECopy (we: WEReference): OSErr;
  586.     function WEPaste (we: WEReference): OSErr;
  587.     function WECanPaste (we: WEReference): Boolean;
  588.  
  589. { Drag Manager support }
  590.     function WEGetHiliteRgn (rangeStart, rangeEnd: LongInt;
  591.                                     we: WEReference): RgnHandle;
  592.     function WETrackDrag (message: DragTrackingMessage;
  593.                                     drag: DragReference;
  594.                                     we: WEReference): OSErr;
  595.     function WEReceiveDrag (drag: DragReference;
  596.                                     we: WEReference): OSErr;
  597.     function WECanAcceptDrag (drag: DragReference;
  598.                                     we: WEReference): Boolean;
  599.     function WEDraggedToTrash (drag: DragReference): Boolean;
  600.  
  601. { Script Manager utilities }
  602.     function WECharByte (offset: LongInt;
  603.                                     we: WEReference): Integer;
  604.     function WECharType (offset: LongInt;
  605.                                     we: WEReference): Integer;
  606.  
  607. { Text Services Manager support }
  608.     function WEInstallTSMHandlers: OSErr;
  609.     function WERemoveTSMHandlers: OSErr;
  610.     procedure WEStopInlineSession (we: WEReference);
  611.  
  612. { additional features }
  613.     function WEFeatureFlag (feature: Integer;
  614.                                     action: Integer;
  615.                                     we: WEReference): Integer;
  616.     function WEGetInfo (selector: OSType;
  617.                                     info: univ Ptr;
  618.                                     we: WEReference): OSErr;
  619.     function WESetInfo (selector: OSType;
  620.                                     info: univ Ptr;
  621.                                     we: WEReference): OSErr;
  622.  
  623. { long coordinates utility routines }
  624.     procedure WELongPointToPoint ({const} var lp: LongPt;
  625.                                     var p: Point);
  626.     procedure WEPointToLongPoint (p: Point;
  627.                                     var lp: LongPt);
  628.     procedure WESetLongRect (var lr: LongRect;
  629.                                     left, top, right, bottom: LongInt);
  630.     procedure WELongRectToRect ({const} var lr: LongRect;
  631.                                     var r: Rect);
  632.     procedure WERectToLongRect ({const} var r: Rect;
  633.                                     var lr: LongRect);
  634.     procedure WEOffsetLongRect (var lr: LongRect;
  635.                                     hOffset, vOffset: LongInt);
  636.     function WELongPointInLongRect ({const} var lp: LongPt;
  637.                                     {const} var lr: LongRect): Boolean;
  638.  
  639. implementation
  640. end.